
/****** Object:  UserDefinedFunction [dbo].[ApiTranslateWord]    Script Date: 07.09.2021 13:39:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date, ,>
-- Description:	<Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[ApiTranslateWord]
(
	@word nvarchar(50), @lang varchar(2)
	
)
RETURNS  nvarchar(50)
AS
BEGIN
declare @trans nvarchar(50);
 set @trans=@word;

	 if @lang<>'PL'
	 BEGIN
	  
		set @trans=   ISNULL((select Translation from dbo.ApiTranslations where Org = @word and Lang=@lang),@word);
		

	 END
	 return @trans;
END



GO


